package com.chhh.cranelease.service.impl;

import com.chhh.cranelease.entity.PeopleLog;
import com.chhh.cranelease.entity.Repair;
import com.chhh.cranelease.mapper.BusinessManageMapper;
import com.chhh.cranelease.mapper.IntegratedmanageMapper;
import com.chhh.cranelease.model.PeopleLogModel;
import com.chhh.cranelease.model.RepairModel;
import com.chhh.cranelease.service.IntegratedmanageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IntegratedmanageServiceImpl implements IntegratedmanageService {

    @Autowired
    private IntegratedmanageMapper integratedmanageMapper;

    @Autowired
    private BusinessManageMapper businessManageMapper;

    @Override
    public List<PeopleLogModel> selectAllPeopleLog(String s_name, String s_card, String pl_license, String state_name) {
        return integratedmanageMapper.selectAllPeopleLog(s_card,s_name,state_name,pl_license);
    }

    @Override
    public Integer updatePeopleLog(PeopleLog peopleLog) {
        return integratedmanageMapper.updatePeopleLog(peopleLog);
    }
    // 维修记录
    @Override
    public List<RepairModel> selectAllRepair(String r_num, Double r_highcost, Double r_lowcost) {
        return integratedmanageMapper.selectAllRepair(r_num,r_highcost,r_lowcost);
    }

    @Override
    public Integer updateRepair(Repair repair) {
        Integer repairs = null;
        if (repair.getR_state()==1){
            businessManageMapper.updateCarLogState(repair);
            repairs = integratedmanageMapper.updateRepair(repair);
        }
        return repairs;
    }
}
